﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.Equipment.DTO;
using PowerHub.MES.DTO.Equipment.QueryDTO;
using PowerHub.MES.Entities.Equipment;
using PowerHub.MES.IServices.IEquipment;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.Equipment
{

    /// <summary>
    /// 设备管理
    /// </summary>
    [ApiController]
    [Route("Api/MES/Equipment/[controller]/[action]")]
    public class EquipmentManagementController
    {

        private IEquipment_EquipmentManagementServices _Equipment_EquipmentManagementServices;

        public EquipmentManagementController(IEquipment_EquipmentManagementServices EquipmentManagementServices)
        {
            _Equipment_EquipmentManagementServices = EquipmentManagementServices;
        }

        /// <summary>
        /// 获取设备管理列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取设备管理列表")]
        public async Task<OperationPageResult<List<Equipment_EquipmentManagement>>> GetEquipment_EquipmentManagementPageListAsync([FromBody] QueryEquipment_EquipmentManagementDTO pageQuery)
        {
            return await _Equipment_EquipmentManagementServices.GetEquipment_EquipmentManagementPageListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除设备管理
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除设备管理")]
        public async Task<OperationResult<bool>> DeletionEquipment_EquipmentManagementAsync([FromBody] List<string> Query)
        {
            return await _Equipment_EquipmentManagementServices.DeletionEquipment_EquipmentManagementAsync(Query);
        }

        /// <summary>
        /// 更新设备管理
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新设备管理")]
        public async Task<OperationResult<bool>> UpdateEquipment_EquipmentManagementAsync([FromBody] Equipment_EquipmentManagementDTO Query)
        {
            return await _Equipment_EquipmentManagementServices.UpdateEquipment_EquipmentManagementAsync(Query);
        }

        /// <summary>
        /// 添加设备管理
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加设备管理")]
        public async Task<OperationResult<bool>> CreateEquipment_EquipmentManagementAsync([FromBody] Equipment_EquipmentManagementDTO Query)
        {
            return await _Equipment_EquipmentManagementServices.CreateEquipment_EquipmentManagementAsync(Query);
        }
    }
}
